<html>
<head>
	<link tal:attributes="href theme" type="text/css" rel="stylesheet" href="" />

	<script type="text/javascript" src="js/jquery.js"></script>
	<script type='text/javascript' src='js/jquery.autocomplete.js'></script>
	<script type="text/javascript" src="js/jquery.validate.js"></script>
	<script type="text/javascript" src="js/jquery.form.js"></script>
	<script type="text/javascript">
	$(document).ready(function() {
		// form validation
		$("#task_add").validate({
			rules: {
				pbacklog: {
					required: true
				},
				estimation: {
					required: true
				},
				unit: {
					required: true
				}
			},
			messages: {
				pbacklog: {
					required: '<font color="#FF0000">${pbacklog_required}</font>'
				},
				estimation: {
					required: '<font color="#FF0000">${estimation_required}</font>'
				},
				unit: {
					required: '<font color="#FF0000">${unit_required}</font>'
				}
			}
		});

		$("#task_add").submit(function(){
			$(this).ajaxSubmit();
			return false;
		});

                // Save buttom
                $("#save").click(function(){
			if ($("#task_add").valid() == true) {
				$("#task_add").submit();
				$.nyroModalRemove();
				document.location.reload(true);
			}
                }).mouseover(function(){
                        $(this).css("cursor","pointer");
                });

		// Cancel button
		$("#cancel").click(function(){
			$.nyroModalRemove();
		}).mouseover(function(){
			$(this).css("cursor","pointer");
		});
	})
	</script>
</head>
<body>
<form action="task_add.php" method="post" id="task_add" name="task_add">
<input type="hidden" id="project" value="${project}" />
<table width="480" border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
<tr>
	<td rowspan="3" class="form_left" width="20">&nbsp;</td>
	<td height="20" class="form_title">&nbsp;${title}</td>
</tr>
<tr>
	<td>
	<table width="95%" border="0" cellpadding="1" cellspacing="1" align="center">
	<tr>
		<td align="right" height="20">${prj_backlog}:&nbsp;</td>
		<td width="176">
			<select id="pbacklog" name="pbacklog" class="form_input">
				<option tal:repeat="blog backlog" value='${blog/id_pbacklog}'>${blog/summary}</option>
			</select>
		</td>
	</tr>
	<tr>
		<td align="right" height="20">${estimate}&nbsp;</td>
		<td width="176">
			<input type="text" name="estimation" id="estimation" class="form_input" />
		</td>
	</tr>
	<tr>
		<td align="right">${unit}&nbsp;</td>
		<td>
			<select id="unit" name="unit" class="form_input">
				<option tal:repeat="unit units" value='${unit/id_unit}'>${unit/name}</option>
			</select>
		</td>
	</tr>
	<tr>
		<td colspan="2" class="form_separator">&nbsp;</td>
	</tr>
	</table>
	<table width="99%" border="0" cellpadding="1" cellspacing="1">
		<tr>
			<td align="right" height="40">
				<img src="themes/default/images/btn_save.jpg" border="0" id="save" />
			</td>
			<td width="65">
				<img src="themes/default/images/btn_cancel.jpg" border="0" id="cancel" />
			</td>
		</tr>
	</table>
	</td>
	</tr>
</table>
</form>
</body>
</html>

